<template>
	<view class="container asking-container">
		<!-- 内容区 -->
		<view class="card">
			<image class="avatar" :src="info.avater" mode="aspectFill"></image>
			<view class="doctor-name">{{info.name}}</view>
			<!-- <view class="doctor-desc">@{{info.clinicName}}</view> -->
			<view class="desc">你好这是我的企业微信，今后也可以在这里与我联系。</view>
			<view class="qrcode-box">
				<image class="qrcode" :src="info.doctorFirmQrCode" mode="aspectFit"></image>
				<view class="qrcode-tip">长按识别二维码<br/>添加我的企业微信</view>
			</view>
			<view class="save-tip" @click="saveQrcode">保存二维码至相册 <text class="iconfont save-icon">&#xe613;</text></view>
		</view>
	</view>
</template>

<script setup>
	import { onLoad } from '@dcloudio/uni-app'
	import {ref} from "vue"
	const info = ref({
		name:'',
		clinicName:'',
		doctorFirmQrCode:'',
		avater:'',
	})
	const qrcodeUrl = '/static/logo.png'
	const saveQrcode = () => {
		uni.saveImageToPhotosAlbum({
			filePath: qrcodeUrl,
			success: () => {
				uni.showToast({ title: '保存成功', icon: 'success' })
			},
			fail: (err) => {
				uni.showToast({ title: '保存失败', icon: 'none' })
			}
		})
	}
	onLoad((option) => {
		uni.setNavigationBarTitle({ title: '添加邀请' })
		info.value = option
		console.log(info.value);
	})
</script>

<style lang="scss">
.asking-container {
	min-height: 100vh;
	background: linear-gradient(180deg, #DBFFFB 3%, #D9EFFD 11%, #D7E5FF 22%, #F5F6FA 25%);
	.nav-bar {
		display: flex;
		align-items: center;
		height: 100rpx;
		padding: 0 30rpx;
		background: transparent;
		.nav-back {
			font-size: 44rpx;
			color: #202020;
			margin-right: 20rpx;
		}
		.nav-title {
			font-size: 36rpx;
			font-weight: 600;
			color: #202020;
		}
	}
	.card {
		margin: 0 30rpx 0 30rpx;
		background: #fff;
		border-radius: 24rpx;
		box-shadow: 0 4rpx 24rpx 0 #e9eaec;
		display: flex;
		flex-direction: column;
		align-items: center;
		padding: 40rpx 20rpx 30rpx 20rpx;
		.avatar {
			width: 120rpx;
			height: 120rpx;
			border-radius: 50%;
			margin-bottom: 20rpx;
			border: 2rpx solid #3AD3C1;
		}
		.doctor-name {
			font-size: 32rpx;
			font-weight: 600;
			color: #202020;
			margin-bottom: 8rpx;
		}
		.doctor-desc {
			color: #FFAA00;
			font-size: 24rpx;
			margin-bottom: 18rpx;
		}
		.desc {
			color: #6D6D6D;
			font-size: 26rpx;
			margin-bottom: 32rpx;
			text-align: center;
		}
		.qrcode-box {
			background: #F5F6FA;
			border-radius: 18rpx;
			padding: 30rpx 30rpx 18rpx 30rpx;
			display: flex;
			flex-direction: column;
			align-items: center;
			margin-bottom: 24rpx;
			.qrcode {
				width: 600rpx;
				height: 600rpx;
				margin-bottom: 12rpx;
				background: #fff;
				border-radius: 16rpx;
			}
			.qrcode-tip {
				color: #6D6D6D;
				font-size: 24rpx;
				text-align: center;
				line-height: 36rpx;
			}
		}
		.save-tip {
			color: #3AD3C1;
			font-size: 26rpx;
			margin-top: 10rpx;
			display: flex;
			align-items: center;
			justify-content: center;
			.save-icon {
				font-size: 28rpx;
				margin-left: 8rpx;
			}
			/* 新增点击态样式 */
			&:active {
				opacity: 0.7;
			}
			cursor: pointer;
		}
	}
}
</style>
